/**
 * 
 */
package com.v2future.sjt.collegecheckingattendance.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * @author gaoshang 
 */
public class Preferences
{

	private final Context context;
	SharedPreferences settings;
	SharedPreferences.Editor editor;
	private final String DB_NAME = "trip8080";
	private static Preferences instance;

	public static Preferences getInstance(Context context){
		if (instance == null)
			instance = new Preferences(context);
		return instance;
	}
	private Preferences(Context context){
		this.context = context;
		settings = this.context.getSharedPreferences(DB_NAME, 0);
		editor = settings.edit();
	}

	
	/**
	 *设置软件参数
	 */
	
	/* 设置用户名和密码 */
	public void setUserNameAndPsw(String userName, String passWord){
		
		editor.putString("userName", userName);
		editor.putString("userPwd", passWord);
		editor.commit();
		
	}
	/* 获取用户名和密码 */
	public String getUsereName(){
		
		return settings.getString("userName", "");
		
	}
	public String getPsw(){
		
		return settings.getString("userPwd", "");
		
	}
	
   public void setFirstshow(boolean firstshow){
	   	
	   	editor.putBoolean("FirstShow", firstshow);
	   	editor.commit();
	   	
  }
	   
  public boolean getFristshow(){
	   	
	   	return settings.getBoolean("FirstShow", true);
	   	
  }
	
  public void setMyLineShow(String my_lineshow){
		editor.putString("MyLineShow", my_lineshow);
		editor.commit();
	}
	
	public String getMyLineShow(){
		
		return settings.getString("MyLineShow", "");
		
	}    
  
}
